<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<%@ include file="/static/admin/jsp/include.jsp"%>
	<script type="text/javascript">
        var grid;

        var addFun = function($dialog, $grid, $pjq) {
            var dialog = parent.sy.modalDialog({
                title : '添加用户',
                width : 800,
                height : 600,
                url : sy.contextPath + '/go?path=pzdHome/userEdit',
                buttons : [ {
                    text : '保存',
                    handler : function() {
                        dialog.find('iframe').get(0).contentWindow.submitForm(dialog, grid, parent.$);
                    }
                } ]
            });
        };

        var editFun = function() {
            var rows = grid.datagrid('getSelections');
            if (rows.length != 1) {
                parent.$.messager.w('请选择一条记录进行编辑！');
                return;
            }
            var dialog = parent.sy.modalDialog({
                title : '编辑',
                width : 800,
                height : 600,
                url : sy.contextPath + '/go?path=pzdHome/userEdit&id=' + rows[0].id,
                buttons : [ {
                    text : '保存',
                    handler : function() {
                        dialog.find('iframe').get(0).contentWindow.submitForm(dialog, grid, parent.$);
                    }
                } ]
            });
        };

        //保存数据
        var saveData = function(data) {
            var url = sy.contextPath + '/userRecharge/save';
            $.post(url, data, function() {
                grid.datagrid('reload');
            }, 'json');
        };

        $(function() {
            grid = $('#grid').datagrid({
                url : sy.contextPath + '/userPay/list',
                singleSelect : false,
                frozenColumns : [ [ {
                    width : '100',
                    checkbox:true,
                    field : 'id',
                    align : 'center'
                }] ],
                columns : [ [
                    {
                        width : 100,
                        title : '账号',
                        field : 'userAccount',
                        align : 'center'
                    },{
                        width : 100,
                        title : '类型',
                        field : 'payType',
                        align : 'center',
						formatter : function (v,r,i) {
							if(v == 1){
								return '麻将'
							}else if(v == 2){
							    return '家庭影院'
							}else if(v == 3){
							    return '游戏房';
							}else if(v == 4){
							    return '足球';
							}else if(v == 5){
							    return '其他零食饮料';
							}
                        }
                    },{
                        width : 150,
                        title : '消费时间',
                        field : 'createTime',
                        align : 'center'
                    }
                ] ]
            });
        });

        //充值
        var recharge = function (id) {
            parent.sy.modalDialog({
                title : '充值',
                width : 800,
                height : 600,
                url : sy.contextPath + '/go?path=pzdHome/recharge&id=' + id
            });

        }

        //扣款
        var multiMoeny = function (id) {
            parent.sy.modalDialog({
                title : '消费',
                width : 800,
                height : 600,
                url : sy.contextPath + '/go?path=pzdHome/multi&id=' + id
            });
        }
	</script>
</head>
<body>
<div id="toolbar">
	<form id="searchForm">
		<div>
			<input type="text" class="easyui-textbox" name="name" style="width: 150px" prompt="商场名称"/>
			<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa-search'" onclick="grid.datagrid('load',sy.serializeObject($('#searchForm')));">过滤</a>
			<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa-search-minus'" onclick="$('#searchForm input').val('');grid.datagrid('load',{});">重置过滤</a>
		</div>
	</form>
	<div class="tbbutton">
	</div>
</div>
<table id="grid" data-options="fit:true,border:false"></table>
</body>
</html>